<template>
  <a-config-provider :locale="locale">
    <router-view></router-view>
  </a-config-provider>


</template>
<script setup>
import zh from "ant-design-vue/es/locale/zh_CN";
import en from "ant-design-vue/es/locale/en_US";
import useLangStore from "./store/lang";
import { useRoute } from "vue-router";
import setTitle from "./utils/setTitle";
const LangStore = useLangStore();
const langs = {
  zh,
  en,
};
const locale = ref(langs[LangStore.lang]);

watch(
   ()=>LangStore.lang,
   ()=>{
    locale.value = langs[LangStore.lang];
    setTitle(route);

   },
  );
  // 动态切换网站标题
  // 监听路由
  // 切换中英文
  const route = useRoute();
  const router = useRouter();

  watch(
    () => router.currentRoute.value,
    ()=>{
    //  const common = "geek cms 管理系统";
    //  let {title} =  route.meta;
    //  if (title) {
    //   title = t("route."+title);
    //  }
    //   document.title = title?`${title}-${common}` : common;
    setTitle(route);

    }

  );

  
  
</script>
<style>
html,
body,
#app{
  height: 100vh;
}
</style>